package com.mvp.shq.washer.entity;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/8/30.
 */

public class RechargeMoney {

    /**
     * rechargeMoney : 30
     * coupons : [{"couponName":"快速洗免单","couponCount":1},{"couponName":"单脱免单","couponCount":1}]
     */

    private BigDecimal rechargeMoney;
    private List<CouponsBean> coupons;
    private boolean select;

    public static RechargeMoney objectFromData(String str) {

        return new Gson().fromJson(str, RechargeMoney.class);
    }

    public static List<RechargeMoney> arrayRechargeMoneyFromData(String str) {

        Type listType = new TypeToken<ArrayList<RechargeMoney>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public BigDecimal getRechargeMoney() {
        return rechargeMoney;
    }

    public void setRechargeMoney(BigDecimal rechargeMoney) {
        this.rechargeMoney = rechargeMoney;
    }

    public List<CouponsBean> getCoupons() {
        return coupons;
    }

    public void setCoupons(List<CouponsBean> coupons) {
        this.coupons = coupons;
    }

    public boolean isSelect() {
        return select;
    }

    public void setSelect(boolean select) {
        this.select = select;
    }

    public static class CouponsBean {
        /**
         * couponName : 快速洗免单
         * couponCount : 1
         */

        private String couponName;
        private int couponCount;

        public static CouponsBean objectFromData(String str) {

            return new Gson().fromJson(str, CouponsBean.class);
        }

        public static List<CouponsBean> arrayCouponsBeanFromData(String str) {

            Type listType = new TypeToken<ArrayList<CouponsBean>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public String getCouponName() {
            return couponName;
        }

        public void setCouponName(String couponName) {
            this.couponName = couponName;
        }

        public int getCouponCount() {
            return couponCount;
        }

        public void setCouponCount(int couponCount) {
            this.couponCount = couponCount;
        }
    }
}
